<html>
	<form method="POST" action="createWork3.php" >
		<?php echo '待配送貨件單號：' . $_POST['_trackNumber'] . '<br>'; ?>
		選擇時段：
		<select name="_date">
			<option value="2013-6-23">2013-6-23</option>
			<option value="2013-6-24">2013-6-24</option>
			<option value="2013-6-25">2013-6-25</option>
			<option value="2013-6-26">2013-6-26</option>
			<option value="2013-6-27">2013-6-27</option>
		</select>
		<select name="_timeSlot">
			<option value="早">早</option>
			<option value="晚">晚</option>
		</select><br>
<?php
	$_trackNumber = $_POST['_trackNumber'];
	echo "位於" . $_wareHouse . "倉庫的員工";
	$main = '<hr><input type="hidden" name="_trackNumber" value=' . $_trackNumber . '>';
	$link=mysql_connect("localhost", "root" ,"1123");
	mysql_select_db("dd") or die("No database");
	//哪個員工
	$query = "	Select ID, name
				from staff
				where ID not in(select ID from work) and warehouse_name = '" . $_wareHouse . "';";
	$result = mysql_query($query) or die("Error Message:".mysql_error());
	$count = 0;	
	$main .= '<table width="300" border="solid">';
	$main .= '<tr><td>選取</td><td>ID</td><td>姓名</td></tr>';
	while(list($a[0], $a[1])= mysql_fetch_row($result))
	{
		$main .= '<tr><td><input type="radio" name="_id" value=' . $a[0] . '></td>';
		for($i = 0 ; $i < 2 ; $i++)
		{
			$main .= '<td>' . $a[$i] . '</td>';
		}
		$main .= '</tr>';
		$count += 1;
	}
	echo "共" . $count . "人：";
	$main .= '</table>';
	echo $main;
	
	//哪台車
	$query = "	Select license, type
				from truck
				where license not in(select license from delivery_period);";
	$result = mysql_query($query) or die("Error Message:".mysql_error());
	$count = 0;	
	$main = '<table width="300" border="solid">';
	$main .= '<tr><td>選取</td><td>車牌</td><td>車型</td></tr>';
	while(list($a[0], $a[1])= mysql_fetch_row($result))
	{
		$main .= '<tr><td><input type="radio" name="_license" value=' . $a[0] . '></td>';
		for($i = 0 ; $i < 2 ; $i++)
		{
			$main .= '<td>' . $a[$i] . '</td>';
		}
		$main .= '</tr>';
		$count += 1;
	}
	echo "可分配貨車共" . $count . "台：";
	$main .= '</table>';
	
	$main .= '<input type="submit" name="" value="分配工作給此員工">';
	$main .= '</form>';
	echo $main;
	
	mysql_close ($link);	
?>
</html>